<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>v-on指令基础</title>
</head>
<body>
<div id="app">
    <button v-on:click="doIt">v-on指令</button>
    <input type="button" value="v-on简写" @click="doIt"/>
    <input type="button" value="双击事件" @dbclick="doIt"/>
    <input type="button" value="鼠标滑过" @mouseenter="doIt"/>
    <h2 @click="addwages">{{wages}}</h2>
</div>
<!-- 生产环境版本，优化了尺寸和速度 -->
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script type="text/javascript">
    var vue = new Vue({
        el: "#app",
        data: {
            wages: "做it"
        },
        methods: {
            doIt: function () {
                alert(this.wages);
            },
            addwages: function () {
                this.wages+=",干一年，工资×2"
            }
        }
    })
</script>
</body>
</html>
